From: Florian Müllner Date: Thu, 20 Nov 2025 14:51:23 +0000 (+0100) Subject: swipeTracker: Flip pan gesture velocity in RTL locales X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~44^2~93 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=799a842d3a11b9d0df0e69d2d6a07ce66f926ba2;p=gnome-shell.git swipeTracker: Flip pan gesture velocity in RTL locales Like the gesture delta, the final velocity needs to be flipped in RTL locales, otherwise we end up cancelling out the gesture progress. Part-of: --- diff --git a/js/ui/swipeTracker.js b/js/ui/swipeTracker.js index 30afdef7b..45b23bfae 100644 --- a/js/ui/swipeTracker.js +++ b/js/ui/swipeTracker.js @@ -653,8 +653,8 @@ export const SwipeTracker = GObject.registerClass({ _endPanGesture(panGesture) { const velocity = panGesture.get_velocity(); const v = this.orientation === Clutter.Orientation.HORIZONTAL - ? -velocity.get_x() - : -velocity.get_y(); + ? this._getGestureDirFactor() * velocity.get_x() + : this._getGestureDirFactor() * velocity.get_y(); this._endGesture(v, this._distance, false); } @@ -679,6 +679,14 @@ export const SwipeTracker = GObject.registerClass({ this._endGesture(0, this._distance, false); } + _getGestureDirFactor() { + if (this.orientation === Clutter.Orientation.HORIZONTAL && + Clutter.get_default_text_direction() === Clutter.TextDirection.RTL) + return 1; + + return -1; + } + /** * Confirms a swipe. User has to call this in 'begin' signal handler, * otherwise the swipe wouldn't start. If there's an animation running,